/*
 *	Copyright © 2013 Changsha Shishuo Network Technology Co., Ltd. All rights reserved.
 *	长沙市师说网络科技有限公司 版权所有
 *	http://www.shishuo.com
 */

package com.hlingsoft.xinsuo.dao;


import com.hlingsoft.xinsuo.entity.Lock;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;

/**
 * 用户服务
 * 
 * @author Zhang jiale
 * 
 */

@Repository
public interface LockDao {

	//添加
	public long add(Lock lock);

	/**
	 * 根据id删除
	 * @param devId
	 * @return
	 */
	public int deleteByDevId(@Param("devId") String devId);



	//通过手机和设备
	public Lock findByIdAndState(@Param("id") long id,@Param("state") int state);


	public Lock findById(@Param("id") long id);

	/**
	 * 根据设备查询
	 * @param devId
	 * @return
	 */
	public List<Lock> findByDevId(@Param("devId") String devId);

	/**
	 * 通过手机查找
	 * @param phone
	 * @return
	 */
	public List<Lock> findByPhone(@Param("phone") String phone);


	public List<Lock> findByPhoneAndState(@Param("phone") String phone,@Param("state") int state);


	/**
	 * 手机和状态查询
	 * @param phone
	 * @param state
	 * @return
	 */
	public List<Lock> findByDevTypeAndPhoneAndState(@Param("devType") String devType,@Param("phone") String phone,@Param("state") int state);

	/**
	 * 通过手机号，设备查找
	 * @param phone
	 * @param devId
	 * @return
	 */
	public Lock findByPhoneAndDevId(@Param("phone") String phone ,@Param("devId") String devId);

	//更新
	public int updateLock(Lock lock);
}
